import Vue from 'vue'
import Router from 'vue-router'
// import layout from '@/view/home'
// import store from '../store/index.js'

//添加空白页,解决嵌套路由对象页面内容区域显示侧边栏
// import BlankPage from '@/view/blankpage'

Vue.use(Router)

export const constantRoutes = [
  // {
  //   path:'/',

  //   path: '/login',
  //   component: resolve => require(['@/view/login.vue'], resolve),
  //   hidden: true,
  //   meta: { title: '登录' }
  // }
  {
    path: '/',
    hidden: true,
    redirect: "/login",
    component: resolve => require(['@/view/blankpage.vue'], resolve),
    children: [{
      path: '/login',
      component: resolve => require(['@/view/login.vue'], resolve),
      hidden: true,
      meta: {
        title: '登录'
      }
    }],
  },
];

export const asyncRoutes = [

];


const createRouter = () => new Router({
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRoutes
})

const router = createRouter()

export function resetRouter() {

  const newRouter = createRouter();

  router.matcher = newRouter.matcher
}


export default router
